exports.get_search_data = async (ctx, next) => {

    let qs = require('querystring');
    let http = require('http');
    let params = qs.parse(ctx.querystring);
    let start = params.start;
    let end = params.end;
    let keyword = params.keyword;

    var data = {
        s: keyword,
        start: start,
        end: end
    };

    var content = qs.stringify(data);
    console.log(content);
    var options = {
        hostname : 'dushu.xiaomi.com',
        prot: 80,
        path: '/store/v0/lib/query/onebox?' + content,
        method: 'GET'
    };
    var data = await new Promise(function(resovle, reject) {
        var req = http.request(options, function(res) {        
            let data = '';
            res.setEncoding('utf8');
            res.on('data', function(chunk){
                data += chunk;
            });
            res.on('end', function(){
                resovle(data);
            });
        });
        req.end();
    }); 
    ctx.body = data.toString();
}